package com.ysd.lis.service.lab;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.yulichang.base.MPJBaseService;
import com.ysd.common.Result;
import com.ysd.lis.entity.lab.LabMaininfo;
import com.ysd.lis.request.*;
import com.ysd.lis.request.lab.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author Cfz
 * @since 2023-12-26
 */
public interface LabMaininfoService extends MPJBaseService<LabMaininfo> {

    Result insertMaininfoByReqNo(AddLabMaininfo labReqMain) throws JsonProcessingException;

    Result insertMaininfoBySpecimen(AddLabMaininfo labReqMain) throws JsonProcessingException;

    Result updateMaininfo(LabMaininfoCreateOrUpdateDto input) throws JsonProcessingException;

    Result updateMaininfoByScanReqNo(LabMaininfoCreateOrUpdateDto input) throws JsonProcessingException;

    Result deleteMaininfoById(LabMaininfo labMaininfo);

    Result findLabMaininfo(LabMaininfo labMaininfo);

    /*微生物获取上机记录*/
    Result findLabMaininfoBac(LabMaininfo labMaininfo);

    Result findReviewedResutByLabMaininfo(ReviewedMaininfoDto reviewedMaininfoDto);

    Result findRptResultByLabMaininfo(String id);

    Result findInspectResultList(ReviewedMaininfoDto reviewedMaininfoDto);

    Result updateIsChkBySampleNos(UpdateIsChkDto updateIsChkDto);

    Result previewRpt(LabMaininfo labMaininfo, int printFlag);

    Result previewBacRpt(LabMaininfo labMaininfo) throws JsonProcessingException;

    Result findLabMainInfoList(LabMainInfoDto mainInfoDto);

    /**
     * 更改完审核人、检验人后更新上机记录数据
     *
     * @param input 入参
     */
    Result updateTestChkDoctorAfterAuth(UptMainInfoTextChkDoctorDto input) throws JsonProcessingException;


    /**
     * 取消审核
     *
     * @param labMaininfo
     */
    Result unChkMainInfo(LabMaininfo labMaininfo) throws JsonProcessingException;

    /**
     * 批量取消审核
     *
     * @param input
     */
    Result unChkMainInfoMany(LabMainInfoBatchUnChk input) throws JsonProcessingException;

    /**
     * 批量删除检验记录
     *
     * @param input
     */
    Result LabMainInfoBatchDelete(LabMainInfoBatchDelete input);

    /**
     * 批量审核检验记录
     *
     * @param input
     */
    Result LabMainInfoBatchChk(LabMainInfoBatchChk input) throws JsonProcessingException;

    /**
     * 批量审核检验记录（挨个处理）
     *
     * @param input
     */
    Result batchChkLabMaininfo(BachChkBatchChk input) throws JsonProcessingException;

    /**
     * 批量打印检验记录
     *
     * @param input
     */
    Result LabMainInfoBatchPrint(LabMainInfoBatchPrint input);

    /**
     * 合并打印
     *
     * @param batchPrintDto
     */
    Result labMainInfoMergePrint(BatchPrintDto batchPrintDto) throws JsonProcessingException;

    /*批量打印报告*/
    Result PrintRptBatch(List<LabMaininfo> labMaininfos);

    /**
     * 打印检验记录
     *
     * @param labMaininfo
     */
    Result LabMainInfoPrint(LabMaininfo labMaininfo);

    Result findLabMainInfos(LabMainInfoDtos mainInfoDto);

    /*更新自助机打印状态*/
    Result updateMainInfoPrintStatus(UpdateMaininfoAfterAutoPrinted input);

    Result testQueryInfo(TestQueryDto testQueryDto);

    Result reqQueryInfo(TestQueryDto testQueryDto);

    /**
     * 标本合并
     *
     * @param input 合并参数
     */
    Result mergeTestList(LabMainInfoMerge input);

    Result batchUpdateRptResultByTemplate(LabTemResultParam param);

    Result saveTestResultBatch(UpdateTestResultParams updateTestResultParams);

    Result updateBacTestChkDoctorAfterAuth(UptMainInfoTextChkDoctorDto input);

    Result unChkBacMainInfo(LabMaininfo labMaininfo) throws JsonProcessingException;

    Result updateBacMaininfo(LabMaininfo labMaininfo);

    Result bachChkBatchPrint(BachChkBatchChk bachChkBatchChk);

    /*阳性报表*/
    Result getPositiveReports(GetPositiveReportDto input);

    /*验证标本号是否已经创建*/
    Result validateIsExistMainInfo(LabMaininfo labMaininfo);

    /*扫码上机验证*/
    Result validateByScanReqNo(LabMaininfo labMaininfo);

    /*报告查询导出特定格式excel*/
    void downloadReportExcel(ReportExportExcelParam reportExportExcelParam, HttpServletResponse response) throws IOException;

    /**
     * 根据REQ_NO获取当前标本的结果信息
     *
     * @param reqNo,rptGroup
     */
    Result findRptResultByLabMainReqNo(String reqNo, String rptGroup);
}
